package com.etooling.pdm.entity;


import com.etooling.framework.entity.AttachFile;
import com.etooling.framework.entity.Employee;
import com.etooling.framework.svo.AbstractEntity;
import lombok.Data;

import javax.persistence.*;
import java.util.Date;

/**
 * 产品管理
 */
@Entity
@Data
@Table(name = "t_goods", schema = "pdm")
public class Goods extends AbstractEntity {
    public static final String STATUS_IS_DEL = "禁用";
    public static final String STATUS_IS_RUN = "启用";
    public static final String STATUS_DELETE = "删除";


    Employee creator;//创建人
    Date createTime;// 创建时间
    Employee modifier;//修改人
    Date lastModifiedTime; //最后修改时间

    GoodsType goodsType;
    String materialCode;// (唯一)物料编码
    String name;// 名称
    String reqGoodsName;//产品的别名
    String unit;// 单位
    String memo;// 描述
    String status;// 状态
    String companyId;
    String imgId;
    String imgUrl;
    String goodsNamesPath;// 产品属性名拼接而成
    String goodsCodesPath;// 产品属性值拼接而成


    @Deprecated
    AttachFile photoFile;

    @ManyToOne(targetEntity = Employee.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "creator_id")
    public Employee getCreator() {
        return creator;
    }

    @ManyToOne(targetEntity = Employee.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "modifier_id")
    public Employee getModifier() {
        return modifier;
    }

    @ManyToOne(targetEntity = GoodsType.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "goods_type_id")
    public GoodsType getGoodsType() {
        return goodsType;
    }

    @ManyToOne(targetEntity = AttachFile.class, fetch = FetchType.LAZY)
    @JoinColumn(name = "photo_file")
    public AttachFile getPhotoFile() {
        return photoFile;
    }

    @Column(columnDefinition = "text")
    public String getMemo() {
        return memo;
    }

    @Deprecated
    @Transient
    String erpStatus;// ERP状态，区分新增产品是否入库，已经是否是暂时新增的无料新增
    @Deprecated
    @Transient
    String batchId; //excelID
    @Deprecated
    @Transient
    Double price;// 基础价格
    @Deprecated
    @Transient
    String materialNum;// 物料数量
    @Deprecated
    @Transient
    String extraCode;// erp编码
    @Deprecated
    @Transient
    Double weightPrice;//重量单价
    @Deprecated
    @Transient
    Double density;//密度
    @Deprecated
    @Transient
    String weightExpression;//重量公式

    @Transient
    public String getErpStatus() {
        return erpStatus;
    }

    @Transient
    public void setErpStatus(String erpStatus) {
        this.erpStatus = erpStatus;
    }

    @Transient
    public String getBatchId() {
        return batchId;
    }

    @Transient
    public void setBatchId(String batchId) {
        this.batchId = batchId;
    }

    @Transient
    public Double getPrice() {
        return price;
    }

    @Transient
    public void setPrice(Double price) {
        this.price = price;
    }

    @Transient
    public String getMaterialNum() {
        return materialNum;
    }

    @Transient
    public void setMaterialNum(String materialNum) {
        this.materialNum = materialNum;
    }

    @Transient
    public String getExtraCode() {
        return extraCode;
    }

    @Transient
    public void setExtraCode(String extraCode) {
        this.extraCode = extraCode;
    }

    @Transient
    public Double getWeightPrice() {
        return weightPrice;
    }

    @Transient
    public void setWeightPrice(Double weightPrice) {
        this.weightPrice = weightPrice;
    }

    @Transient
    public Double getDensity() {
        return density;
    }

    @Transient
    public void setDensity(Double density) {
        this.density = density;
    }

    @Transient
    public String getWeightExpression() {
        return weightExpression;
    }

    @Transient
    public void setWeightExpression(String weightExpression) {
        this.weightExpression = weightExpression;
    }
}
